<?php
class BrandControl extends CommonControl {
	public function index(){ 
		$brand=new BrandModel();
		$brandDate=$brand->fetchAll();
		require_once('View/Admin/Brand/brandlist.php');
	}
	public function add(){
		$this->view->display('add.html');
	}
	
	public function addck(){
		$brand=new BrandModel();
		$num=$brand->insert($_POST);
		if($num>0){
			$this->success('/index.php/Admin/Brand/index');
		}else{
			$this->error('/index.php/Admin/Brand/index');
		}
	}
	public function update(){
		$id=$_GET['id'];
		$brand=new BrandModel();
		$brandDate=$brand->fetchRow($id);
		require_once('View/Admin/Brand/update.php');
	}
	public function updateck(){
		$brand=new BrandModel();
		$num=$brand->update($_POST);
		if($num>0){
			$this->success('/index.php/Admin/Brand/index');
		}else{
			$this->error('/index.php/Admin/Brand/index');
		}
	}
	public function delete(){
		$id=$_GET['id'];
		$brand=new BrandModel();
		$num=$brandDate=$brand->delete($id);
		if($num==1){
			$this->success('/index.php/Admin/Brand/index');
		}else {
			$this->error('/index.php/Admin/Brand/index');
		}
	}
}
?>